<template>
  <el-input v-model="s_value" :disabled="disabled" @change="onChange"  />
</template>

<script>
import { generateID } from '@/utils/utils'
export default {
    name: 'idInput',
    data() {
        return{
            s_value: '',
        }
    },
    methods:{
        onChange(v) {
            this.$emit('change', v)
        }
    },
    props:{
        value: String,
        disabled: {
            type: Boolean,
            default: true
        }
    },
    model:{
        prop: 'value',
        event: 'change'
    },
    mounted() {
        if(this.value){
            this.s_value = this.value
            // this.disabled = true
        }
        else{
            this.s_value = generateID();
            this.onChange(this.s_value)
        }
    }
}
</script>

<style>

</style>